package com.stu.manager.stuScore.controller;

import com.stu.manager.config.Result;
import com.stu.manager.stuScore.service.StudentFindScoreService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/stu/findScore")
@CrossOrigin
public class StudentFindScore {
    @Autowired
    private StudentFindScoreService studentFindScoreService;


    @GetMapping("gradeInfo")
    @ApiOperation("学生登录后获取各年份列表")
    public Result gradeInfo(HttpServletRequest request){
        String stuNumber = request.getHeader("X-Token");
        Result result = studentFindScoreService.gradeInfo(stuNumber);

        return result;
    }


    @GetMapping("scoreInfo/{classGrade}")
    @ApiOperation("学生查询成绩")
    public Result scoreInfo(@PathVariable String classGrade,HttpServletRequest request){
        String stuNumber = request.getHeader("X-Token");
        Result result = studentFindScoreService.scoreInfo(classGrade, stuNumber);
        return result;
    }


}
